package com.stockz.scanner.screen;

import java.util.List;

import com.stockz.core.model.Bar;
import com.stockz.scanner.screen.configuration.EligibleScripScreenConfiguration;

public class EligibleScripScreen implements
		Screen<EligibleScripScreenConfiguration> {

	private final EligibleScripScreenConfiguration configuration = 
			new EligibleScripScreenConfiguration();
	
	@Override
	public EligibleScripScreenConfiguration getConfiguration() {
		return configuration;
	}

	@Override
	public int getMandatorySpan() {
		return 100;
	}

	@Override
	public boolean isMatch(List<Bar> barList) {
		if(barList == null || barList.size() < getMandatorySpan()){
			return false;
		}
		Bar bar = barList.get(0);
		return bar.getClose() > configuration.getCloseLowerLimit() && bar.getClose() < configuration.getCloseUpperLimit();
	}

}
